package com.example.javasample.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.javasample.domain.BookDO;
import com.example.javasample.service.IBookService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * BookController
 *
 * @author Kylin
 */
@Tag(name = "书籍")
@RestController
@RequestMapping("/book")
public class BookController {

    @Autowired
    private IBookService bookService;

    @ApiOperationSupport(order = 1)
    @Operation(summary = "列表（selectPage）", description = "")
    @GetMapping(value = "/selectPage")
    public IPage<BookDO> selectPage(@ParameterObject BookDO book, @RequestParam int pageNum, @RequestParam int pageSize) {
        return bookService.selectPage(book, pageNum, pageSize);
    }

    @ApiOperationSupport(order = 2)
    @Operation(summary = "列表（listPage）", description = "")
    @GetMapping(value = "/listPage")
    public IPage<BookDO> listPage(@ParameterObject BookDO book, @RequestParam int pageNum, @RequestParam int pageSize) {
        return bookService.listPage(book, pageNum, pageSize);
    }

}
